package com.jwaoo.mobile.view.explore.presenter;

import android.app.Activity;
import com.dx.as.JWCache;
import com.dx.as.LoadingDialog;
import com.dx.as.listener.IProInterface;
import com.dx.as.listener.IViewInterface;
import com.jwaoo.mobile.view.explore.bean.UserBean;
import com.jwaoo.mobile.view.explore.model.UserModel;

import java.util.List;
import java.util.Map;

/**
 * Created by jwaoo on 2017/8/12.
 */

public class UserPresenter extends IProInterface{
    private UserModel model;
    private IUserView contactView;
    public UserPresenter(Activity activity, IViewInterface iViewInterface) {
        super(activity, iViewInterface);
        model = new UserModel(activity.getApplicationContext(),this);
        contactView = (IUserView)iViewInterface;
    }

    public void getNearByList(Map map){
        LoadingDialog.getInstance(getActivity()).show();
        model.getNearByList(map);
    }


    @Override
    public void initialataData() {

    }

    @Override
    public void onResponse(Object response, int flg) {
        LoadingDialog.getInstance(JWCache.getContext()).dismiss();
        if (response != null){
            List<UserBean> list = (List<UserBean>) response;
            contactView.getData(list);
        }
    }
}
